<script>
    // 实现concat方法
    Array.prototype.mlconcat = function myconcat(...values) {
        let newArr = [];
        newArr.push(...this)

        if (values.length === 0) {
            return newArr
        }
        values.forEach(value => {
            if (Array.isArray(value)) {
                newArr.push(...value)
            } else {
                newArr.push(value)
            }
        })

        return newArr;
    }
    let arr1 = [1, 2];
    let arr2 = [3, 4];
    let arr3 = [5, 6];
    let arr4 = [7, 8];
    // concat拼接多个数组形成一个数组
    // 拼接也可以是一个普通值  返回一个新的数组
    console.log(arr1.mlconcat(arr2, arr3, arr4, "hello"))
    console.log(arr1.mlconcat("malu"))
    console.log(arr1.mlconcat())
</script>